﻿namespace ManagerClinic.CanLamSang
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.XtraEditors;
    using ManagerClinic.Core.Common;
    using ManagerClinic.Core.Business;
    using ManagerClinic.Modules;
    using ManagerClinic.Ultilities.Ultility;

    public partial class frmDanhSachPhieuSieuAm : DevExpress.XtraEditors.XtraForm
    {
        PhieuSieuAmBussiness objPhieuSABusiness = null;
        PhieuSieuAmEntity objPhieuSA = null;
        IList<PhieuSieuAmEntity> lstPhieuSA = null;

        public frmDanhSachPhieuSieuAm()
        {
            InitializeComponent();
            objPhieuSABusiness = new PhieuSieuAmBussiness();
        }

        private void grdDanhSachBenhNhanKhamBenh_DoubleClick(object sender, EventArgs e)
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                //frmPhieuSieuAm frm = new frmPhieuSieuAm((int)ConstantManagerClinic.StateInsertOrUpdate.Update, fcnMaPhieuSieuAm());
                //frm.ShowDialog();
            }
        }
        string fcnMaPhieuSieuAm()
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                objPhieuSA = (PhieuSieuAmEntity)gvDanhSachBenhNhanKhamBenh.GetFocusedRow();
                return objPhieuSA.MaPhieuSieuAm;
            }
            else
                return null;
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        void LoadData(int trangthai)
        {
            lstPhieuSA = objPhieuSABusiness.GetPhieuSieuAmByTrangThai(trangthai);
            if (lstPhieuSA != null)
                grdDanhSachBenhNhanKhamBenh.DataSource = lstPhieuSA;
        }

        private void radTrangThaiKhamBenh_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex);
        }

        private void frmDanhSachPhieuSieuAm_Load(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex);
        }
    }
}